<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html">
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title></title>
</head>
<body erke-hide>
</body>
<script>
/**
 * @param {number[]} findNums
 * @param {number[]} nums
 * @return {number[]}
 */
var nextGreaterElement = function(findNums, nums) {
	var res=[];
    for(var i=0;i<findNums.length;i++){
    	var index=getIndex(nums,findNums[i]);
    	for(var j=index;j<nums.length;j++){
    		if(nums[j]>findNums[i]){
    			res.push(nums[j]);
    			break;
    		};
    	};
    	if(res.length-1<i){
    		res.push(-1);
    	};
    };
    console.log(res);
};
function getIndex(arr,n){
	for(var i in arr){
		if(arr[i]==n){
			return i;
		}
	};
	return -1;
};
var res=new nextGreaterElement([2,4],[1,2,3,4]);
</script>
</html>